load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library")

cc_binary(
    name = "libv2x_message_reporter.so",
    linkshared = True,
    linkstatic = False,
    deps = [":v2x_message_reporter_lib"],
)

cc_library(
    name = "v2x_message_reporter_lib",
    srcs = ["v2x_message_reporter_component.cc"],
    hdrs = ["v2x_message_reporter_component.h"],
    linkopts = [
        "-pthread -lz -lrt -luuid"
    ],
    deps = [
        "@com_github_google_glog//:glog",
        "@fastrtps//:fastrtps",
        "@com_github_gflags_gflags//:gflags",
        "@airosrt//:airosrt",
        "//middleware/protocol/proto:v2xpb-asn-message-frame_cc_pb",
        "//base/device_connect/proto:cloud_data_cc_pb",
	      "//base/device_connect/proto:rsu_data_cc_pb",
        "//middleware/protocol/common:global_conf",
	      "//middleware/protocol/proto:cloud_v2x_message_cc_pb",
    ],
    copts = [
        "-DUSE_CYBERRT",
	      "-DMODULE_NAME=\\\"v2x_message_reporter\\\""
    ],
)

cc_test(
     name="v2x_message_reporter_ut",
     srcs = [
        "ut/v2x_message_reporter_component_test.cc",
        "v2x_message_reporter_component.h",
     ],
    linkopts = [
        "-pthread -lz"
    ],
    deps=[
      "@com_google_googletest//:gtest_main",
      ":v2x_message_reporter_lib",
    ],
    copts = [
        "-DUSE_CYBERRT"
    ],
    linkstatic = False,
)
